package com.qdlc.p2p.biz.executer;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Service;

/**
 * 事件管理器 初始化系统自定对象
 * 
 * @author zxc
 */
@Service
public class ExecuterHelper implements ApplicationContextAware{
	
	private static ApplicationContext context;
	
	public static <T extends Executer> T getExecuter(Class<T> executerClass){
		T executer = context.getBean(executerClass);
		return executer;
	}

	@Override
	public void setApplicationContext(ApplicationContext applicationContext)
			throws BeansException {
		context = applicationContext;
	}

}
